number = list(map(int,input().split(" ")))
num = number[1:]
count = {}
for n in num:
    if n in count:
        count[n] +=1
    else:
        count[n] = 1

max_n = None
max_count = 0

for key,value in count.items():
    if value > max_count:
        max_count = value
        max_n = key
print(max_n,max_count)
